package cn.jbolt.login.captcha;

import cn.jbolt.core.base.JBoltGlobalConfigKey;
import cn.jbolt.core.cache.JBoltGlobalConfigCache;
import cn.jbolt.core.controller.base.JBoltCommonController;
import cn.jbolt.core.crossorigin.CrossOrigin;
import cn.jbolt.core.model.base.JBoltBaseModel;
import cn.jbolt.core.service.base.JBoltBaseService;
import com.jfinal.core.Path;

@CrossOrigin
@Path("/api/captcha")
public class JBoltCaptchaApiController extends JBoltCommonController {
    public void index(){
        renderJBoltCaptcha(JBoltGlobalConfigCache.me.getConfigValue(JBoltGlobalConfigKey.JBOLT_LOGIN_CAPTURE_TYPE));
    }


    /**
     * 检测是否需要验证码
     */
    public void checkUse() {
        Boolean checkCaptcha= JBoltGlobalConfigCache.me.isJBoltLoginUseCapture();
        renderJBoltApiSuccessWithData(checkCaptcha, null);
    }

    @Override
    protected JBoltBaseService<? extends JBoltBaseModel<?>> getModelService() {
        return null;
    }
}
